//  this library.
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:hktk_app/util/font_util.dart';
import 'package:hktk_app/util/view_util.dart';
import 'package:hktk_app/widget/back_button_widget.dart';
import 'package:hktk_app/widget/login/reset_password_widget.dart';
// import 'package:hktk_app/widget/login/reset_password_widget.dart';

/// 忘记密码页面
class ResetPasswordPage extends StatefulWidget {
  /// 手机号码
  final String phoneStr;

  const ResetPasswordPage({
    super.key,
    required this.phoneStr,
  });

  @override
  State<ResetPasswordPage> createState() => _ResetPasswordPageState();
}

class _ResetPasswordPageState extends State<ResetPasswordPage> {
  late BuildContext _context;

  /// 背景
  get _background => Image.asset(
    "images/login/login_background.png",
    width: 750,
    height: 450,
    fit: BoxFit.fill,
  );

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    _context = context;
    // 获取页面宽高
    double width = ScreenUtil().screenWidth;
    double height =ScreenUtil().screenHeight;
    return Scaffold(
      backgroundColor: colorWhite2,
      body: SizedBox(
        width: width,
        height: height,
        child: SingleChildScrollView(
          child: SizedBox(
            width: width,
            height: height,
            child: Stack(
              children: [
                _background,
                _content(),
              ],
            ),
          ),
        ),
      ),
    );
  }

  /// 内容显示方法的
  _content() {
    return Column(
      children: [
        _titleItem(),
        Expanded(
          child: ResetPasswordWidget(
            phoneStr: widget.phoneStr,
            title: "忘记密码",
            resetPass: false,
          ),
        ),
      ],
    );
  }

  /// 标题组件
  _titleItem() {
    double top = ScreenUtil().statusBarHeight;
    return Container(
      height: 88,
      margin: EdgeInsets.only(top: top),
      padding: EdgeInsets.symmetric(horizontal: 48),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          BackButtonWidget.close(pageContext: _context,size: 24,),
          Text(
            "忘记密码",
            style: FontUtil.fontBlack1(24, fontWeight: FontWeight.w500),
          ),
          // 右边占位使用
          SizedBox(
            height: 24,
            width: 24,
          ),
        ],
      ),
    );
  }
}
